package Model;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.awt.font.TextAttribute;
import java.util.Hashtable;
import java.util.Map;

import javax.swing.JLabel;

public class ClickableLabel extends JLabel {

	public ClickableLabel(String str) {
		super(str);
		this.addMouseListener(new MouseAdapter() {

			 	Font original;

			    @Override
			    public void mouseEntered(MouseEvent e) {
			        original = e.getComponent().getFont();
			        Map attributes = original.getAttributes();
			        attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
			        attributes.put(TextAttribute.FOREGROUND, Color.BLUE);
			        e.getComponent().setFont(original.deriveFont(attributes));
			    }

			    @Override
			    public void mouseExited(MouseEvent e) {
			        e.getComponent().setFont(original);
			    }
			
		});
	}
}
